<!DOCTYPE HTML>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse" id="search">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            方案名称：<input name="projectName" type="text"/>
                        </li>

                        <li>
                            方案类型：<input name="projectType" type="text"/>
                        </li>

                        <li>
                            预计方案开始时间：<input name="exProjectFrom" type="text">
                        </li>

                        <li>
                            预计方案结束时间：<input name="exProjectEnd" type="text">
                        </li>

                        <li>
                            <a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-success btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="toDetail()" shiro:hasPermission="zzjx:pefctasstable:add">
                <i class="fa fa"></i> 查看
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table data-mobile-responsive="true" id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('zzjx:pefassproject:edit')}]];
    var removeFlag = [[${@permission.hasPermi('zzjx:pefassproject:remove')}]];
    var pefassobjectListFlag = [[${@permission.hasPermi('zzjx:pefassobject:view')}]];
    var prefix = ctx + "zzjx/pefctasstable";

    $(function () {
        $("#search").hide();

    })

    $(function () {
        var options = {
            url: prefix + "/showList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "绩效方案",
            showExport: true,
            showSearch: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'projectName',
                    title: '方案名称',
                    sortable: true,
                    formatter: function (value, row, index) {
                        /* if (pefassobjectListFlag != "hidden"){
                            return '<a href="#" onclick="toPefassobject(\'' + row.id + '\')">' + value + '</a>';
                        }else {
                            return value;
                        } */
                        return value;
                    }
                },
                {
                    field: 'exProjectFrom',
                    title: '预计方案开始时间',
                    sortable: true
                },
                {
                    field: 'exProjectEnd',
                    title: '预计方案结束时间',
                    sortable: true
                },
                {
                    field: 'projectStatus',
                    title: '状态',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel([[${@dict.getType('zzjx_pefassproject_status')}]], value);
                    }
                }]
        };
        $.table.init(options);

    });

    $(function () {
        $("input[name='showSearch']").click();
    })

    /**
     * 查看详情
     */
    function toDetail() {
        var row = $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) {
            return row;
        });
        var length = row.length;
        if (length != 1) {
            $.modal.alert("请选择一条数据!");
            return;
        }
        ;
        var id = row[0].id;
        var url = prefix + "/showDetail/" + id;

        //createMenuItem(url, "表单详情")
        $.modal.openFull("表单详情", url);
    }


</script>
</body>
</html>